import {sendMessageWebSocket} from "@/middleware/socket/webSocket";
import {serialize} from "@/middleware/socket/fastJson";
import {UserService} from "@/middleware/db/userService";
import _ from 'lodash';
import {v4 as uuid} from 'uuid';

export let TalkMessageHandler = {

    async sendTextMessage(textMessage) {
        const me = await UserService.getCurrentUser()
        const messageResult = serialize('TM', {
            cid: '12',
            uid: me.id,
            tuid: textMessage.targerId,
            msgId: uuid(),
            content: textMessage.content,
            cs: _.now()
        });
        sendMessageWebSocket(messageResult)
    },

    receiverMessage() {

    }
}